import random,easygui
secret= random.randint(1,99)
guess=0
tries=1
easygui.msgbox("""AHOY!I'm the Dread Pirate Roberts,and I have a secret!
it is a number form 1 to 99 .I'll give you 6 tries.""")

while guess!=secret and tries <= 6:
    guess = easygui.integerbox("What's yer guess,matey?")
    if not guess:break
    if guess < secret:
        easygui.msgbox(str(guess) + "is too low,ye scurvy dog!")
    elif guess >secret:
        easygui.msgbox(str(guess) + "is too high,landlubber!")
    easygui.msgbox("已经输入了\n" + str(tries))
    tries =tries+1
    
    if guess==secret:
        easygui.msgbox("Avast!ye got it! Found my secret,ye did.")
    else:
        easygui.msgbox("No more guesses!better luck next time,matey!")